<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of mproduct
 *
 * @author sonUIT
 */
class Mproduct extends CI_Model {
    public $matp;
    public $Status_matp;
    public $tentp;
    public $Status_tentp;
    public $hinhanh;
    public $Status_hinhanh;
    public $matl;
    public $Status_matl;
    public $matg;
    public $Status_matg;
    public $namxuatban;
    public $Status_namxuatban;
    public $manxb;
    public $Status_manxb;
    public $sotrang;
    public $Status_sotrang;
    public $caption;
    public $Status_caption;
    public $giagoc;
    public $Status_giagoc;
    public $giaban;
    public $Status_giaban;

    public function __construct() {
        parent::__construct();
        $this->load->database();
        $this->matg="";        
        $this->manxb="";
        $this->matl="";
        $this->matp="";
        $this->namxuatban="";
        $this->sotrang="";
        $this->tentp="";
    }
    public function GetAllProducts(){
        return $this->db->get('tacpham')->result_array();
        
    }
    public function Get($id){
        $Issucess=FALSE;
        $this->db->select("*");//('MATP,TENTP,HINHANH,NAMXB,TP.MANXB,SOTRANG,CAPTION,GIAGOC,GIABAN,TENNXB');
        $this->db->from('tacpham');
        $this->db->where('MATP', $id);
        //var_dump($this->db->get()->result_array());
        $data= $this->db->get()->row_array();
        if(!empty($data))
        {           
            $this->caption=$data['CAPTION'];
            $this->hinhanh=$data['HINHANH'];
            $this->manxb=$data['MANXB'];
            $this->matg=$data["MATG"];
            $this->matl=$data["MATL"];
            $this->matp=$data['MATP'];
            $this->namxuatban=$data['NAMXUATBAN'];
            $this->sotrang=$data['SOTRANG'];
            $this->tentp=$data['TENTP'];
            $this->giaban=$data["GIABAN"];
            $Issucess=TRUE;                    
        }
        return $Issucess;
        
    }
}

?>
